<!-- application/views/scripts/plugin/index.phtml -->
<?php 
/*
$menu = $this->guiElements()->menu()->setDecorator(X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::MENU_CONTEXTUAL));
$this->layout()->subNavigator =	$menu
	->addLinkRoute(X_Env::_('megavideo_manage_add_new_entry'), "megavideo", "add")
	//->addButton(X_Env::_('megavideo_bookmarklets_title'), "javascript:showModal('bookmarklets'); return false;" )
	->addLinkRoute(X_Env::_('megavideo_manage_options'), "config", "index", array('key' => 'megavideo', 'r' => X_Env::encode('megavideo:index')));
*/
$breadcrumb = $this->guiElements()->menu()->setDecorator(X_VlcShares_Skins_Manager::i()->getDecorator(X_VlcShares_Skins_Manager::MENU_BREADCRUMB));
/* @var $breadcrumb X_VlcShares_Elements_Menu */
$this->layout()->breadcrumb = $breadcrumb
	->addLinkRoute(X_Env::_('Dashboard'), 'manage', 'index')
	->addLabel(X_Env::_('plugin_title'));

?>
<?php //$this->headScript()->appendFile($this->baseUrl("/js/plugin/index.js")); ?>
<?php $this->headScript()->captureStart(Zend_View_Helper_Placeholder_Container_Abstract::PREPEND); ?>
<?php $this->headScript()->captureEnd(); ?>
<?php $this->headTitle()->prepend(X_Env::_('plugin_title')); ?>

<?php if ( count($this->messages) ) :?>
<div class="span-24 last" id="manage-messages">
	<ul>
		<?php foreach ($this->messages as $i => $message ): ?>
			<?php if ( !is_array($message) ) $message = array('text' => $message, 'type' => 'warning'); ?>
			<li class="<?php echo @$message['type']?>">
				<img src="<?php echo @$this->baseUrl("/images/msg_{$message['type']}.png");?>" alt="<?php echo @$message['type']; ?>" />
				<?php echo $message['text']?>
			</li>
		<?php endforeach; ?>
	</ul>
</div>
<?php endif; ?>

<?php echo $this->action('menu', 'plugin', null, array('filter' => $this->filter)); ?>

<div class="unit">
	<div class="container">
		<div class="box">
			<div class="header">
				<span class="title"><?php echo X_Env::_('plugin_table_title_'.$this->filter); ?></span>
			</div>
			<div class="content">
				<table id="plugins-table" class="table">
					<tr class="header">
						<th width="50%"><?php echo X_Env::_('plugin_index_uninstalllist_name'); ?></th>
						<th width="25%"><?php echo X_Env::_('plugin_index_uninstalllist_key'); ?></th>
						<th width="50px"><?php echo X_Env::_('plugin_index_uninstalllist_status'); ?></th>
						<th width="auto"><?php echo X_Env::_('plugin_index_uninstalllist_version'); ?></th>
						<th width="100px"><?php echo X_Env::_('plugin_index_uninstalllist_option'); ?></th>
					</tr>
					<?php if ( count($this->plugins) ) : ?>
						<?php foreach ($this->plugins as $i => $plugin): ?>
						<?php /* @var $plugin Application_Model_Plugin */ ?>
							<tr class="<?php echo $i % 2 ? 'alt' : ''; ?>">
								<td><?php echo X_Env::_($plugin->getLabel()); ?></td>
								<td><?php echo $plugin->getKey(); ?></td>
								<td><?php echo $plugin->isEnabled() ? X_Env::_('plugin_status_enabled') : X_Env::_('plugin_status_disabled') ; ?></td>
								<td><?php echo $plugin->getVersion() != null ? $plugin->getVersion() : '&tilde;' ?></td>
								<td>
									<ul class="inline-menu">
										<?php if ($plugin->getType() != Application_Model_Plugin::SYSTEM): ?>
											<li class="ui-state-default">
												<?php if ( $plugin->isEnabled() ) : ?>
													<a class="ui-icon ui-icon-bullet" title="<?php echo X_Env::_('plugin_action_disable')?>"
														href="<?php echo $this->url(
															array(
																'controller' => 'plugin',
																'action'	 => 'disable',
																'key'		 => $plugin->getKey(),
																'csrf'		 => $this->csrf,
																'r'			 => $this->filter
															), 'default', true
														); ?>">
														<?php echo X_Env::_('plugin_action_disable')?>
													</a>
												<?php else: ?>
													<a class="ui-icon ui-icon-check" title="<?php echo X_Env::_('plugin_action_enable')?>"
														href="<?php echo $this->url(
															array(
																'controller' => 'plugin',
																'action'	 => 'enable',
																'key'		 => $plugin->getKey(),
																'csrf'		 => $this->csrf,
																'r'			 => $this->filter
															), 'default', true
														); ?>">
														<?php echo X_Env::_('plugin_action_enable')?>
													</a>
												<?php endif; ?>
											</li>
										<?php endif; ?>
										<?php if ($plugin->getType() == Application_Model_Plugin::USER): ?>
											<li class="ui-state-default">
												<a class="ui-icon ui-icon-trash" title="<?php echo X_Env::_('plugin_action_uninstall')?>"
													href="<?php echo $this->url(
														array(
															'controller' => 'plugin',
															'action'	 => 'uconfirm',
															'key'		 => $plugin->getKey()
														), 'default', true
													); ?>">
													<?php echo X_Env::_('plugin_action_uninstall')?>
												</a>
											</li>
										<?php endif; ?>
									</ul>
								</td>
							</tr>
						<?php endforeach; ?>
					<?php else: ?>
						<tr>
							<td colspan="4"><center><i><?php echo X_Env::_('plugin_index_uninstalllist_noplugin'); ?></i></center>
						</tr>
					<?php endif; ?>
				</table>
			</div>
		</div>
	</div>
</div>

